//
//  SEPrescriptionDrugsNewConfirmCell.swift
//  SmartEyeForDoctor
//
//  Created by QDSG on 2021/5/13.
//

import UIKit

class SEPrescriptionDrugsNewConfirmCell: UITableViewCell {
    
    weak var delegate: SEPrescriptionNewCellDelegate?
    
    func update(with viewModel: SEPrescriptionViewModel) {
        nameLabel.text = viewModel.prescription.auditor
        timeLabel.text = viewModel.prescription.passTime
        statusLabel.text = viewModel.prescription.status.text
        statusLabel.textColor = viewModel.prescription.status.textColor
        
        nameTitleLabel.isHidden = viewModel.reviewerHidden
        timeTitleLabel.isHidden = viewModel.reviewerHidden
        nameLabel.isHidden = viewModel.reviewerHidden
        timeLabel.isHidden = viewModel.reviewerHidden
        statusLabel.isHidden = viewModel.reviewerHidden
        confirmButton.isHidden = viewModel.confirmButtonHidden
    }
    
    @IBAction private func confirmAction() {
        delegate?.confirmCell(didTappedConfirm: self)
    }
    
    @IBOutlet private weak var nameTitleLabel: UILabel!
    @IBOutlet private weak var timeTitleLabel: UILabel!
    @IBOutlet private weak var nameLabel: UILabel!
    @IBOutlet private weak var timeLabel: UILabel!
    @IBOutlet private weak var statusLabel: UILabel!
    
    @IBOutlet private weak var confirmButton: UIButton! {
        didSet {
            confirmButton.isIgnoreEvent = false
            confirmButton.layer.cornerRadius = confirmButton.height / 2
        }
    }
    
}
